﻿
using System;

namespace MedLink2011.Web.Services
{
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using MedLink2011.Web.Models;


    // Implements application logic using the MedLink2011Entities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    [RequiresAuthentication]
    [EnableClientAccess()]
    public class MedLink2011Service : LinqToEntitiesDomainService<MedLink2011Entities>
    {
        protected override void OnError(DomainServiceErrorInfo errorInfo)
        {
            // some custom handling for specific typr
            if (errorInfo.Error is NullReferenceException)
            {
                errorInfo.Error = new DomainException("There was a null reference Exception ");
            }
            base.OnError(errorInfo);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Appointments' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        //[RequiresRole("Managers")]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Appointment> GetAppointments()
        {
            return this.ObjectContext.Appointments;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Appointment> GetAppointmentsForPatients(int patientId)
        {
            return this.ObjectContext.Appointments.Where(p => p.Patient_Id == patientId);
        }
        public void InsertAppointment(Appointment appointment)
        {
            if ((appointment.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(appointment, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Appointments.AddObject(appointment);
            }
        }

        public void UpdateAppointment(Appointment currentAppointment)
        {
            this.ObjectContext.Appointments.AttachAsModified(currentAppointment, this.ChangeSet.GetOriginal(currentAppointment));
        }

        public void DeleteAppointment(Appointment appointment)
        {
            if ((appointment.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(appointment, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Appointments.Attach(appointment);
                this.ObjectContext.Appointments.DeleteObject(appointment);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'BodyRegions' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<BodyRegion> GetBodyRegions()
        {
            return this.ObjectContext.BodyRegions;
        }

        public void InsertBodyRegion(BodyRegion bodyRegion)
        {
            if ((bodyRegion.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(bodyRegion, EntityState.Added);
            }
            else
            {
                this.ObjectContext.BodyRegions.AddObject(bodyRegion);
            }
        }

        public void UpdateBodyRegion(BodyRegion currentBodyRegion)
        {
            this.ObjectContext.BodyRegions.AttachAsModified(currentBodyRegion, this.ChangeSet.GetOriginal(currentBodyRegion));
        }

        public void DeleteBodyRegion(BodyRegion bodyRegion)
        {
            if ((bodyRegion.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(bodyRegion, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.BodyRegions.Attach(bodyRegion);
                this.ObjectContext.BodyRegions.DeleteObject(bodyRegion);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Charges' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Charge> GetCharges()
        {
            return this.ObjectContext.Charges;
        }

        public void InsertCharge(Charge charge)
        {
            if ((charge.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(charge, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Charges.AddObject(charge);
            }
        }

        public void UpdateCharge(Charge currentCharge)
        {
            this.ObjectContext.Charges.AttachAsModified(currentCharge, this.ChangeSet.GetOriginal(currentCharge));
        }

        public void DeleteCharge(Charge charge)
        {
            if ((charge.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(charge, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Charges.Attach(charge);
                this.ObjectContext.Charges.DeleteObject(charge);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'ClinicCharts' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<ClinicChart> GetClinicCharts()
        {
            return this.ObjectContext.ClinicCharts;
        }
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<ClinicChart> GetClinicChartsForPatients(int patientId)
        {
            return this.ObjectContext.ClinicCharts.Where(p => p.Patient_Id == patientId);
        }

        public void InsertClinicChart(ClinicChart clinicChart)
        {
            if ((clinicChart.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(clinicChart, EntityState.Added);
            }
            else
            {
                this.ObjectContext.ClinicCharts.AddObject(clinicChart);
            }
        }

        public void UpdateClinicChart(ClinicChart currentClinicChart)
        {
            this.ObjectContext.ClinicCharts.AttachAsModified(currentClinicChart, this.ChangeSet.GetOriginal(currentClinicChart));
        }

        public void DeleteClinicChart(ClinicChart clinicChart)
        {
            if ((clinicChart.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(clinicChart, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.ClinicCharts.Attach(clinicChart);
                this.ObjectContext.ClinicCharts.DeleteObject(clinicChart);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Consult_Payments' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Consult_Payment> GetConsult_Payments()
        {
            return this.ObjectContext.Consult_Payments;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Consult_Payment> GetConsult_PaymentsForPatients(int patientId)
        {
            return this.ObjectContext.Consult_Payments.Where(p => p.Patient_Id == patientId);
        }

        public void InsertConsult_Payments(Consult_Payment consult_Payments)
        {
            if ((consult_Payments.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(consult_Payments, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Consult_Payments.AddObject(consult_Payments);
            }
        }

        public void UpdateConsult_Payments(Consult_Payment currentConsult_Payments)
        {
            this.ObjectContext.Consult_Payments.AttachAsModified(currentConsult_Payments, this.ChangeSet.GetOriginal(currentConsult_Payments));
        }

        public void DeleteConsult_Payments(Consult_Payment consult_Payments)
        {
            if ((consult_Payments.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(consult_Payments, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Consult_Payments.Attach(consult_Payments);
                this.ObjectContext.Consult_Payments.DeleteObject(consult_Payments);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Consultations' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Consultation> GetConsultations()
        {
            return this.ObjectContext.Consultations;
        }
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Consultation> GetConsultationsForPatients(int patientId)
        {
            return this.ObjectContext.Consultations.Where(p => p.Patient_Id == patientId);
        }
        public void InsertConsultation(Consultation consultation)
        {
            if ((consultation.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(consultation, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Consultations.AddObject(consultation);
            }
        }

        public void UpdateConsultation(Consultation currentConsultation)
        {
            this.ObjectContext.Consultations.AttachAsModified(currentConsultation, this.ChangeSet.GetOriginal(currentConsultation));
        }

        public void DeleteConsultation(Consultation consultation)
        {
            if ((consultation.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(consultation, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Consultations.Attach(consultation);
                this.ObjectContext.Consultations.DeleteObject(consultation);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Diagnos' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Diagno> GetDiagnos()
        {
            return this.ObjectContext.Diagnos;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Diagno> GetDiagnosForPatients(int patientId)
        {
            return this.ObjectContext.Diagnos.Where(p => p.Patient_Id == patientId);
        }

        public void InsertDiagno(Diagno diagno)
        {
            if ((diagno.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(diagno, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Diagnos.AddObject(diagno);
            }
        }

        public void UpdateDiagno(Diagno currentDiagno)
        {
            this.ObjectContext.Diagnos.AttachAsModified(currentDiagno, this.ChangeSet.GetOriginal(currentDiagno));
        }

        public void DeleteDiagno(Diagno diagno)
        {
            if ((diagno.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(diagno, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Diagnos.Attach(diagno);
                this.ObjectContext.Diagnos.DeleteObject(diagno);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Doctors' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Doctor> GetDoctors()
        {
            return this.ObjectContext.Doctors;
        }

        public void InsertDoctor(Doctor doctor)
        {
            if ((doctor.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(doctor, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Doctors.AddObject(doctor);
            }
        }

        public void UpdateDoctor(Doctor currentDoctor)
        {
            this.ObjectContext.Doctors.AttachAsModified(currentDoctor, this.ChangeSet.GetOriginal(currentDoctor));
        }

        public void DeleteDoctor(Doctor doctor)
        {
            if ((doctor.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(doctor, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Doctors.Attach(doctor);
                this.ObjectContext.Doctors.DeleteObject(doctor);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Cardios' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Cardio> GetEvaluation_Cardios()
        {
            return this.ObjectContext.Evaluation_Cardios;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Cardio> GetEvaluation_CardiosForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Cardios.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertEvaluation_Cardios(Evaluation_Cardio evaluation_Cardios)
        {
            if ((evaluation_Cardios.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Cardios, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Cardios.AddObject(evaluation_Cardios);
            }
        }

        public void UpdateEvaluation_Cardios(Evaluation_Cardio currentEvaluation_Cardios)
        {
            this.ObjectContext.Evaluation_Cardios.AttachAsModified(currentEvaluation_Cardios, this.ChangeSet.GetOriginal(currentEvaluation_Cardios));
        }

        public void DeleteEvaluation_Cardios(Evaluation_Cardio evaluation_Cardios)
        {
            if ((evaluation_Cardios.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Cardios, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Cardios.Attach(evaluation_Cardios);
                this.ObjectContext.Evaluation_Cardios.DeleteObject(evaluation_Cardios);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Constitutionals' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Constitutional> GetEvaluation_Constitutionals()
        {
            return this.ObjectContext.Evaluation_Constitutionals;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Constitutional> GetEvaluation_ConstitutionalsForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Constitutionals.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertEvaluation_Constitutionals(Evaluation_Constitutional evaluation_Constitutionals)
        {
            if ((evaluation_Constitutionals.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Constitutionals, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Constitutionals.AddObject(evaluation_Constitutionals);
            }
        }

        public void UpdateEvaluation_Constitutionals(Evaluation_Constitutional currentEvaluation_Constitutionals)
        {
            this.ObjectContext.Evaluation_Constitutionals.AttachAsModified(currentEvaluation_Constitutionals, this.ChangeSet.GetOriginal(currentEvaluation_Constitutionals));
        }

        public void DeleteEvaluation_Constitutionals(Evaluation_Constitutional evaluation_Constitutionals)
        {
            if ((evaluation_Constitutionals.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Constitutionals, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Constitutionals.Attach(evaluation_Constitutionals);
                this.ObjectContext.Evaluation_Constitutionals.DeleteObject(evaluation_Constitutionals);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Ents' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Ent> GetEvaluation_Ents()
        {
            return this.ObjectContext.Evaluation_Ents;
        }
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Ent> GetEvaluation_EntsForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Ents.Where(c => c.ClinicChart_Id == ClinicChartID);
        }
        public void InsertEvaluation_Ents(Evaluation_Ent evaluation_Ents)
        {
            if ((evaluation_Ents.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Ents, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Ents.AddObject(evaluation_Ents);
            }
        }

        public void UpdateEvaluation_Ents(Evaluation_Ent currentEvaluation_Ents)
        {
            this.ObjectContext.Evaluation_Ents.AttachAsModified(currentEvaluation_Ents, this.ChangeSet.GetOriginal(currentEvaluation_Ents));
        }

        public void DeleteEvaluation_Ents(Evaluation_Ent evaluation_Ents)
        {
            if ((evaluation_Ents.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Ents, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Ents.Attach(evaluation_Ents);
                this.ObjectContext.Evaluation_Ents.DeleteObject(evaluation_Ents);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Extrems' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Extrem> GetEvaluation_Extrems()
        {
            return this.ObjectContext.Evaluation_Extrems;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Extrem> GetEvaluation_ExtremsForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Extrems.Where(c => c.ClinicChart_Id == ClinicChartID);
        }


        public void InsertEvaluation_Extrems(Evaluation_Extrem evaluation_Extrems)
        {
            if ((evaluation_Extrems.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Extrems, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Extrems.AddObject(evaluation_Extrems);
            }
        }

        public void UpdateEvaluation_Extrems(Evaluation_Extrem currentEvaluation_Extrems)
        {
            this.ObjectContext.Evaluation_Extrems.AttachAsModified(currentEvaluation_Extrems, this.ChangeSet.GetOriginal(currentEvaluation_Extrems));
        }

        public void DeleteEvaluation_Extrems(Evaluation_Extrem evaluation_Extrems)
        {
            if ((evaluation_Extrems.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Extrems, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Extrems.Attach(evaluation_Extrems);
                this.ObjectContext.Evaluation_Extrems.DeleteObject(evaluation_Extrems);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Gastros' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Gastro> GetEvaluation_Gastros()
        {
            return this.ObjectContext.Evaluation_Gastros;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Gastro> GetEvaluation_GastrosForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Gastros.Where(c => c.ClinicChart_Id == ClinicChartID);
        }
        public void InsertEvaluation_Gastros(Evaluation_Gastro evaluation_Gastros)
        {
            if ((evaluation_Gastros.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Gastros, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Gastros.AddObject(evaluation_Gastros);
            }
        }

        public void UpdateEvaluation_Gastros(Evaluation_Gastro currentEvaluation_Gastros)
        {
            this.ObjectContext.Evaluation_Gastros.AttachAsModified(currentEvaluation_Gastros, this.ChangeSet.GetOriginal(currentEvaluation_Gastros));
        }

        public void DeleteEvaluation_Gastros(Evaluation_Gastro evaluation_Gastros)
        {
            if ((evaluation_Gastros.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Gastros, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Gastros.Attach(evaluation_Gastros);
                this.ObjectContext.Evaluation_Gastros.DeleteObject(evaluation_Gastros);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Lymphs' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Lymph> GetEvaluation_Lymphs()
        {
            return this.ObjectContext.Evaluation_Lymphs;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Lymph> GetEvaluation_LymphsForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Lymphs.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertEvaluation_Lymphs(Evaluation_Lymph evaluation_Lymphs)
        {
            if ((evaluation_Lymphs.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Lymphs, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Lymphs.AddObject(evaluation_Lymphs);
            }
        }

        public void UpdateEvaluation_Lymphs(Evaluation_Lymph currentEvaluation_Lymphs)
        {
            this.ObjectContext.Evaluation_Lymphs.AttachAsModified(currentEvaluation_Lymphs, this.ChangeSet.GetOriginal(currentEvaluation_Lymphs));
        }

        public void DeleteEvaluation_Lymphs(Evaluation_Lymph evaluation_Lymphs)
        {
            if ((evaluation_Lymphs.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Lymphs, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Lymphs.Attach(evaluation_Lymphs);
                this.ObjectContext.Evaluation_Lymphs.DeleteObject(evaluation_Lymphs);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Muscs' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Musc> GetEvaluation_Muscs()
        {
            return this.ObjectContext.Evaluation_Muscs;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Musc> GetEvaluation_MuscsForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Muscs.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertEvaluation_Muscs(Evaluation_Musc evaluation_Muscs)
        {
            if ((evaluation_Muscs.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Muscs, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Muscs.AddObject(evaluation_Muscs);
            }
        }

        public void UpdateEvaluation_Muscs(Evaluation_Musc currentEvaluation_Muscs)
        {
            this.ObjectContext.Evaluation_Muscs.AttachAsModified(currentEvaluation_Muscs, this.ChangeSet.GetOriginal(currentEvaluation_Muscs));
        }

        public void DeleteEvaluation_Muscs(Evaluation_Musc evaluation_Muscs)
        {
            if ((evaluation_Muscs.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Muscs, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Muscs.Attach(evaluation_Muscs);
                this.ObjectContext.Evaluation_Muscs.DeleteObject(evaluation_Muscs);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Necks' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Neck> GetEvaluation_Necks()
        {
            return this.ObjectContext.Evaluation_Necks;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Neck> GetEvaluation_NecksForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Necks.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertEvaluation_Necks(Evaluation_Neck evaluation_Necks)
        {
            if ((evaluation_Necks.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Necks, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Necks.AddObject(evaluation_Necks);
            }
        }

        public void UpdateEvaluation_Necks(Evaluation_Neck currentEvaluation_Necks)
        {
            this.ObjectContext.Evaluation_Necks.AttachAsModified(currentEvaluation_Necks, this.ChangeSet.GetOriginal(currentEvaluation_Necks));
        }

        public void DeleteEvaluation_Necks(Evaluation_Neck evaluation_Necks)
        {
            if ((evaluation_Necks.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Necks, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Necks.Attach(evaluation_Necks);
                this.ObjectContext.Evaluation_Necks.DeleteObject(evaluation_Necks);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Neuros' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Neuro> GetEvaluation_Neuros()
        {
            return this.ObjectContext.Evaluation_Neuros;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Neuro> GetEvaluation_NeurosForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Neuros.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertEvaluation_Neuros(Evaluation_Neuro evaluation_Neuros)
        {
            if ((evaluation_Neuros.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Neuros, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Neuros.AddObject(evaluation_Neuros);
            }
        }

        public void UpdateEvaluation_Neuros(Evaluation_Neuro currentEvaluation_Neuros)
        {
            this.ObjectContext.Evaluation_Neuros.AttachAsModified(currentEvaluation_Neuros, this.ChangeSet.GetOriginal(currentEvaluation_Neuros));
        }

        public void DeleteEvaluation_Neuros(Evaluation_Neuro evaluation_Neuros)
        {
            if ((evaluation_Neuros.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Neuros, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Neuros.Attach(evaluation_Neuros);
                this.ObjectContext.Evaluation_Neuros.DeleteObject(evaluation_Neuros);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Resps' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Respi> GetEvaluation_Respis()
        {
            return this.ObjectContext.Evaluation_Respis;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Respi> GetEvaluation_RespisForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Respis.Where(c => c.ClinicChart_Id == ClinicChartID);
        }
        public void InsertEvaluation_Resps(Evaluation_Respi evaluation_Resps)
        {
            if ((evaluation_Resps.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Resps, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Respis.AddObject(evaluation_Resps);
            }
        }

        public void UpdateEvaluation_Resps(Evaluation_Respi currentEvaluation_Resps)
        {
            this.ObjectContext.Evaluation_Respis.AttachAsModified(currentEvaluation_Resps, this.ChangeSet.GetOriginal(currentEvaluation_Resps));
        }

        public void DeleteEvaluation_Resps(Evaluation_Respi evaluation_Resps)
        {
            if ((evaluation_Resps.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Resps, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Respis.Attach(evaluation_Resps);
                this.ObjectContext.Evaluation_Respis.DeleteObject(evaluation_Resps);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Evaluation_Skins' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Skin> GetEvaluation_Skins()
        {
            return this.ObjectContext.Evaluation_Skins;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Evaluation_Skin> GetEvaluation_SkinsForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Evaluation_Skins.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertEvaluation_Skins(Evaluation_Skin evaluation_Skins)
        {
            if ((evaluation_Skins.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Skins, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Evaluation_Skins.AddObject(evaluation_Skins);
            }
        }

        public void UpdateEvaluation_Skins(Evaluation_Skin currentEvaluation_Skins)
        {
            this.ObjectContext.Evaluation_Skins.AttachAsModified(currentEvaluation_Skins, this.ChangeSet.GetOriginal(currentEvaluation_Skins));
        }

        public void DeleteEvaluation_Skins(Evaluation_Skin evaluation_Skins)
        {
            if ((evaluation_Skins.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(evaluation_Skins, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Evaluation_Skins.Attach(evaluation_Skins);
                this.ObjectContext.Evaluation_Skins.DeleteObject(evaluation_Skins);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Exams' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Exam> GetExams()
        {
            return this.ObjectContext.Exams;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Exam> GetExamsForPatients(int patientId)
        {
            return this.ObjectContext.Exams.Where(p => p.Patient_Id == patientId);
        }

        public void InsertExam(Exam exam)
        {
            if ((exam.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(exam, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Exams.AddObject(exam);
            }
        }

        public void UpdateExam(Exam currentExam)
        {
            this.ObjectContext.Exams.AttachAsModified(currentExam, this.ChangeSet.GetOriginal(currentExam));
        }

        public void DeleteExam(Exam exam)
        {
            if ((exam.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(exam, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Exams.Attach(exam);
                this.ObjectContext.Exams.DeleteObject(exam);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'ExamCategories' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<ExamCategory> GetExamCategories()
        {
            return this.ObjectContext.ExamCategories;
        }

        public void InsertExamCategory(ExamCategory examCategory)
        {
            if ((examCategory.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(examCategory, EntityState.Added);
            }
            else
            {
                this.ObjectContext.ExamCategories.AddObject(examCategory);
            }
        }

        public void UpdateExamCategory(ExamCategory currentExamCategory)
        {
            this.ObjectContext.ExamCategories.AttachAsModified(currentExamCategory, this.ChangeSet.GetOriginal(currentExamCategory));
        }

        public void DeleteExamCategory(ExamCategory examCategory)
        {
            if ((examCategory.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(examCategory, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.ExamCategories.Attach(examCategory);
                this.ObjectContext.ExamCategories.DeleteObject(examCategory);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'ExamTypes' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<ExamType> GetExamTypes()
        {
            return this.ObjectContext.ExamTypes;
        }

        public void InsertExamType(ExamType examType)
        {
            if ((examType.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(examType, EntityState.Added);
            }
            else
            {
                this.ObjectContext.ExamTypes.AddObject(examType);
            }
        }

        public void UpdateExamType(ExamType currentExamType)
        {
            this.ObjectContext.ExamTypes.AttachAsModified(currentExamType, this.ChangeSet.GetOriginal(currentExamType));
        }

        public void DeleteExamType(ExamType examType)
        {
            if ((examType.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(examType, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.ExamTypes.Attach(examType);
                this.ObjectContext.ExamTypes.DeleteObject(examType);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Hereditary_Illnesses' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Hereditary_Illne> GetHereditary_Illnes()
        {
            return this.ObjectContext.Hereditary_Illnes;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Hereditary_Illne> GetHereditary_IllnesForClinicCharts(int ClinicChartID)
        {
            return this.ObjectContext.Hereditary_Illnes.Where(c => c.ClinicChart_Id == ClinicChartID);
        }

        public void InsertHereditary_Illnesses(Hereditary_Illne hereditary_Illnesses)
        {
            if ((hereditary_Illnesses.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hereditary_Illnesses, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Hereditary_Illnes.AddObject(hereditary_Illnesses);
            }
        }

        public void UpdateHereditary_Illnesses(Hereditary_Illne currentHereditary_Illnesses)
        {
            this.ObjectContext.Hereditary_Illnes.AttachAsModified(currentHereditary_Illnesses, this.ChangeSet.GetOriginal(currentHereditary_Illnesses));
        }

        public void DeleteHereditary_Illnesses(Hereditary_Illne hereditary_Illnesses)
        {
            if ((hereditary_Illnesses.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hereditary_Illnesses, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Hereditary_Illnes.Attach(hereditary_Illnesses);
                this.ObjectContext.Hereditary_Illnes.DeleteObject(hereditary_Illnesses);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Hospital_beds' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Hospital_bed> GetHospital_bed()
        {
            return this.ObjectContext.Hospital_bed;
        }

        public void InsertHospital_bed(Hospital_bed hospital_beds)
        {
            if ((hospital_beds.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_beds, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Hospital_bed.AddObject(hospital_beds);
            }
        }

        public void UpdateHospital_bed(Hospital_bed currentHospital_beds)
        {
            this.ObjectContext.Hospital_bed.AttachAsModified(currentHospital_beds, this.ChangeSet.GetOriginal(currentHospital_beds));
        }

        public void DeleteHospital_bed(Hospital_bed hospital_beds)
        {
            if ((hospital_beds.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_beds, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Hospital_bed.Attach(hospital_beds);
                this.ObjectContext.Hospital_bed.DeleteObject(hospital_beds);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Hospital_buildings' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Hospital_buildings> GetHospital_buildings()
        {
            return this.ObjectContext.Hospital_buildings;
        }

        public void InsertHospital_buildings(Hospital_buildings hospital_buildings)
        {
            if ((hospital_buildings.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_buildings, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Hospital_buildings.AddObject(hospital_buildings);
            }
        }

        public void UpdateHospital_buildings(Hospital_buildings currentHospital_buildings)
        {
            this.ObjectContext.Hospital_buildings.AttachAsModified(currentHospital_buildings, this.ChangeSet.GetOriginal(currentHospital_buildings));
        }

        public void DeleteHospital_buildings(Hospital_buildings hospital_buildings)
        {
            if ((hospital_buildings.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_buildings, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Hospital_buildings.Attach(hospital_buildings);
                this.ObjectContext.Hospital_buildings.DeleteObject(hospital_buildings);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Hospital_units' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Hospital_units> GetHospital_units()
        {
            return this.ObjectContext.Hospital_units;
        }

        public void InsertHospital_units(Hospital_units hospital_units)
        {
            if ((hospital_units.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_units, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Hospital_units.AddObject(hospital_units);
            }
        }

        public void UpdateHospital_units(Hospital_units currentHospital_units)
        {
            this.ObjectContext.Hospital_units.AttachAsModified(currentHospital_units, this.ChangeSet.GetOriginal(currentHospital_units));
        }

        public void DeleteHospital_units(Hospital_units hospital_units)
        {
            if ((hospital_units.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_units, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Hospital_units.Attach(hospital_units);
                this.ObjectContext.Hospital_units.DeleteObject(hospital_units);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Hospital_wards' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Hospital_wards> GetHospital_wards()
        {
            return this.ObjectContext.Hospital_wards;
        }

        public void InsertHospital_wards(Hospital_wards hospital_wards)
        {
            if ((hospital_wards.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_wards, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Hospital_wards.AddObject(hospital_wards);
            }
        }

        public void UpdateHospital_wards(Hospital_wards currentHospital_wards)
        {
            this.ObjectContext.Hospital_wards.AttachAsModified(currentHospital_wards, this.ChangeSet.GetOriginal(currentHospital_wards));
        }

        public void DeleteHospital_wards(Hospital_wards hospital_wards)
        {
            if ((hospital_wards.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hospital_wards, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Hospital_wards.Attach(hospital_wards);
                this.ObjectContext.Hospital_wards.DeleteObject(hospital_wards);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Inpatient_registrationss' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Inpatient_reg> GetInpatient_regs()
        {
            return this.ObjectContext.Inpatient_regs;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Inpatient_reg> GetInpatient_regsForPatients(int patientId)
        {
            return this.ObjectContext.Inpatient_regs.Where(p => p.Patient_Id == patientId);
        }

        public void InsertInpatient_registrationss(Inpatient_reg Inpatient_regs)
        {
            if ((Inpatient_regs.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(Inpatient_regs, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Inpatient_regs.AddObject(Inpatient_regs);
            }
        }

        public void UpdateInpatient_registrationss(Inpatient_reg currentInpatient_registrationss)
        {
            this.ObjectContext.Inpatient_regs.AttachAsModified(currentInpatient_registrationss, this.ChangeSet.GetOriginal(currentInpatient_registrationss));
        }

        public void DeleteInpatient_registrationss(Inpatient_reg Inpatient_registrationss)
        {
            if ((Inpatient_registrationss.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(Inpatient_registrationss, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Inpatient_regs.Attach(Inpatient_registrationss);
                this.ObjectContext.Inpatient_regs.DeleteObject(Inpatient_registrationss);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Insurances' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Insurance> GetInsurances()
        {
            return this.ObjectContext.Insurances;
        }

        public void InsertInsurance(Insurance insurance)
        {
            if ((insurance.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(insurance, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Insurances.AddObject(insurance);
            }
        }

        public void UpdateInsurance(Insurance currentInsurance)
        {
            this.ObjectContext.Insurances.AttachAsModified(currentInsurance, this.ChangeSet.GetOriginal(currentInsurance));
        }

        public void DeleteInsurance(Insurance insurance)
        {
            if ((insurance.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(insurance, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Insurances.Attach(insurance);
                this.ObjectContext.Insurances.DeleteObject(insurance);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Insurance_Payments' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Insurance_Payment> GetInsurance_Payments()
        {
            return this.ObjectContext.Insurance_Payments;
        }

        public void InsertInsurance_Payments(Insurance_Payment insurance_Payments)
        {
            if ((insurance_Payments.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(insurance_Payments, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Insurance_Payments.AddObject(insurance_Payments);
            }
        }

        public void UpdateInsurance_Payments(Insurance_Payment currentInsurance_Payments)
        {
            this.ObjectContext.Insurance_Payments.AttachAsModified(currentInsurance_Payments, this.ChangeSet.GetOriginal(currentInsurance_Payments));
        }

        public void DeleteInsurance_Payments(Insurance_Payment insurance_Payments)
        {
            if ((insurance_Payments.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(insurance_Payments, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Insurance_Payments.Attach(insurance_Payments);
                this.ObjectContext.Insurance_Payments.DeleteObject(insurance_Payments);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Invoices' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Invoice> GetInvoices()
        {
            return this.ObjectContext.Invoices;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Invoice> GetInvoicesForPatients(int patientId)
        {
            return this.ObjectContext.Invoices.Where(p => p.Patient_Id == patientId);
        }

        public void InsertInvoice(Invoice invoice)
        {
            if ((invoice.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(invoice, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Invoices.AddObject(invoice);
            }
        }

        public void UpdateInvoice(Invoice currentInvoice)
        {
            this.ObjectContext.Invoices.AttachAsModified(currentInvoice, this.ChangeSet.GetOriginal(currentInvoice));
        }

        public void DeleteInvoice(Invoice invoice)
        {
            if ((invoice.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(invoice, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Invoices.Attach(invoice);
                this.ObjectContext.Invoices.DeleteObject(invoice);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Labs' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Lab> GetLabs()
        {
            return this.ObjectContext.Labs;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Lab> GetLabsForPatients(int patientId)
        {
            return this.ObjectContext.Labs.Where(p => p.Patient_Id == patientId);
        }

        public void InsertLab(Lab lab)
        {
            if ((lab.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lab, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Labs.AddObject(lab);
            }
        }

        public void UpdateLab(Lab currentLab)
        {
            this.ObjectContext.Labs.AttachAsModified(currentLab, this.ChangeSet.GetOriginal(currentLab));
        }

        public void DeleteLab(Lab lab)
        {
            if ((lab.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lab, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Labs.Attach(lab);
                this.ObjectContext.Labs.DeleteObject(lab);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Medical_Histories' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Medical_Histo> GetMedical_Histos()
        {
            return this.ObjectContext.Medical_Histos;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Medical_Histo> GetMedical_HistosForPatients(int patientId)
        {
            return this.ObjectContext.Medical_Histos.Where(p => p.Patient_Id == patientId);
        }


        public void InsertMedical_Histories(Medical_Histo medical_Histories)
        {
            if ((medical_Histories.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(medical_Histories, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Medical_Histos.AddObject(medical_Histories);
            }
        }

        public void UpdateMedical_Histories(Medical_Histo currentMedical_Histories)
        {
            this.ObjectContext.Medical_Histos.AttachAsModified(currentMedical_Histories, this.ChangeSet.GetOriginal(currentMedical_Histories));
        }

        public void DeleteMedical_Histories(Medical_Histo medical_Histories)
        {
            if ((medical_Histories.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(medical_Histories, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Medical_Histos.Attach(medical_Histories);
                this.ObjectContext.Medical_Histos.DeleteObject(medical_Histories);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Medicaments' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Medicament> GetMedicaments()
        {
            return this.ObjectContext.Medicaments;
        }

        public void InsertMedicament(Medicament medicament)
        {
            if ((medicament.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(medicament, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Medicaments.AddObject(medicament);
            }
        }

        public void UpdateMedicament(Medicament currentMedicament)
        {
            this.ObjectContext.Medicaments.AttachAsModified(currentMedicament, this.ChangeSet.GetOriginal(currentMedicament));
        }

        public void DeleteMedicament(Medicament medicament)
        {
            if ((medicament.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(medicament, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Medicaments.Attach(medicament);
                this.ObjectContext.Medicaments.DeleteObject(medicament);
            }
        }


        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'MedicationReactions' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<MedicationReaction> GetMedicationReactions()
        {
            return this.ObjectContext.MedicationReactions;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<MedicationReaction> GetMedicationReactionsForPatients(int patientId)
        {
            return this.ObjectContext.MedicationReactions.Where(p => p.Patient_Id == patientId);
        }

        public void InsertMedicationReaction(MedicationReaction medicationReaction)
        {
            if ((medicationReaction.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(medicationReaction, EntityState.Added);
            }
            else
            {
                this.ObjectContext.MedicationReactions.AddObject(medicationReaction);
            }
        }

        public void UpdateMedicationReaction(MedicationReaction currentMedicationReaction)
        {
            this.ObjectContext.MedicationReactions.AttachAsModified(currentMedicationReaction, this.ChangeSet.GetOriginal(currentMedicationReaction));
        }

        public void DeleteMedicationReaction(MedicationReaction medicationReaction)
        {
            if ((medicationReaction.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(medicationReaction, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.MedicationReactions.Attach(medicationReaction);
                this.ObjectContext.MedicationReactions.DeleteObject(medicationReaction);
            }
        }

    

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Newborns' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Newborn> GetNewborns()
        {
            return this.ObjectContext.Newborns;
        }

        public void InsertNewborn(Newborn newborn)
        {
            if ((newborn.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(newborn, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Newborns.AddObject(newborn);
            }
        }

        public void UpdateNewborn(Newborn currentNewborn)
        {
            this.ObjectContext.Newborns.AttachAsModified(currentNewborn, this.ChangeSet.GetOriginal(currentNewborn));
        }

        public void DeleteNewborn(Newborn newborn)
        {
            if ((newborn.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(newborn, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Newborns.Attach(newborn);
                this.ObjectContext.Newborns.DeleteObject(newborn);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Pathologies' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Pathology> GetPathologies()
        {
            return this.ObjectContext.Pathologies;
        }

        public void InsertPathology(Pathology pathology)
        {
            if ((pathology.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(pathology, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Pathologies.AddObject(pathology);
            }
        }

        public void UpdatePathology(Pathology currentPathology)
        {
            this.ObjectContext.Pathologies.AttachAsModified(currentPathology, this.ChangeSet.GetOriginal(currentPathology));
        }

        public void DeletePathology(Pathology pathology)
        {
            if ((pathology.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(pathology, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Pathologies.Attach(pathology);
                this.ObjectContext.Pathologies.DeleteObject(pathology);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Pathology_Categories' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Pathology_Categories> GetPathology_Categories()
        {
            return this.ObjectContext.Pathology_Categories;
        }

        public void InsertPathology_Categories(Pathology_Categories pathology_Categories)
        {
            if ((pathology_Categories.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(pathology_Categories, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Pathology_Categories.AddObject(pathology_Categories);
            }
        }

        public void UpdatePathology_Categories(Pathology_Categories currentPathology_Categories)
        {
            this.ObjectContext.Pathology_Categories.AttachAsModified(currentPathology_Categories, this.ChangeSet.GetOriginal(currentPathology_Categories));
        }

        public void DeletePathology_Categories(Pathology_Categories pathology_Categories)
        {
            if ((pathology_Categories.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(pathology_Categories, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Pathology_Categories.Attach(pathology_Categories);
                this.ObjectContext.Pathology_Categories.DeleteObject(pathology_Categories);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Patients' query.
        //[Query(IsDefault = true, ResultLimit = 1000)]
       // [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Patient> GetPatients()
        {
            return this.ObjectContext.Patients;
        }


        public IQueryable<Patient> GetPatientsForPatients(int patientId)
        {
            return this.ObjectContext.Patients.Where(p => p.Patient_Id == patientId);
        }

        

        public void InsertPatient(Patient patient)
        {
            if ((patient.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(patient, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Patients.AddObject(patient);
            }
        }

        public void UpdatePatient(Patient currentPatient)
        {
            this.ObjectContext.Patients.AttachAsModified(currentPatient, this.ChangeSet.GetOriginal(currentPatient));
        }

        public void DeletePatient(Patient patient)
        {
            if ((patient.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(patient, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Patients.Attach(patient);
                this.ObjectContext.Patients.DeleteObject(patient);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'PatientAllergies' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<PatientAllergy> GetPatientAllergies()
        {
            return this.ObjectContext.PatientAllergies;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<PatientAllergy> GetPatientAllergiesForPatients(int patientId)
        {
            return this.ObjectContext.PatientAllergies.Where(p => p.Patient_Id == patientId);
        }

        public void InsertPatientAllergy(PatientAllergy patientAllergy)
        {
            if ((patientAllergy.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(patientAllergy, EntityState.Added);
            }
            else
            {
                this.ObjectContext.PatientAllergies.AddObject(patientAllergy);
            }
        }

        public void UpdatePatientAllergy(PatientAllergy currentPatientAllergy)
        {
            this.ObjectContext.PatientAllergies.AttachAsModified(currentPatientAllergy, this.ChangeSet.GetOriginal(currentPatientAllergy));
        }

        public void DeletePatientAllergy(PatientAllergy patientAllergy)
        {
            if ((patientAllergy.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(patientAllergy, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.PatientAllergies.Attach(patientAllergy);
                this.ObjectContext.PatientAllergies.DeleteObject(patientAllergy);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Payments' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Payment> GetPayments()
        {
            return this.ObjectContext.Payments;
        }

        public void InsertPayment(Payment payment)
        {
            if ((payment.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(payment, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Payments.AddObject(payment);
            }
        }

        public void UpdatePayment(Payment currentPayment)
        {
            this.ObjectContext.Payments.AttachAsModified(currentPayment, this.ChangeSet.GetOriginal(currentPayment));
        }

        public void DeletePayment(Payment payment)
        {
            if ((payment.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(payment, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Payments.Attach(payment);
                this.ObjectContext.Payments.DeleteObject(payment);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Perinatals' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Perinatal> GetPerinatals()
        {
            return this.ObjectContext.Perinatals;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Perinatal> GetPerinatalsForPatients(int patientId)
        {
            return this.ObjectContext.Perinatals.Where(p => p.Patient_Id == patientId);
        }

        public void InsertPerinatal(Perinatal perinatal)
        {
            if ((perinatal.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(perinatal, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Perinatals.AddObject(perinatal);
            }
        }

        public void UpdatePerinatal(Perinatal currentPerinatal)
        {
            this.ObjectContext.Perinatals.AttachAsModified(currentPerinatal, this.ChangeSet.GetOriginal(currentPerinatal));
        }

        public void DeletePerinatal(Perinatal perinatal)
        {
            if ((perinatal.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(perinatal, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Perinatals.Attach(perinatal);
                this.ObjectContext.Perinatals.DeleteObject(perinatal);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Perinatal_monitors' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Perinatal_monitors> GetPerinatal_monitors()
        {
            return this.ObjectContext.Perinatal_monitors;
        }

        public void InsertPerinatal_monitors(Perinatal_monitors perinatal_monitors)
        {
            if ((perinatal_monitors.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(perinatal_monitors, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Perinatal_monitors.AddObject(perinatal_monitors);
            }
        }

        public void UpdatePerinatal_monitors(Perinatal_monitors currentPerinatal_monitors)
        {
            this.ObjectContext.Perinatal_monitors.AttachAsModified(currentPerinatal_monitors, this.ChangeSet.GetOriginal(currentPerinatal_monitors));
        }

        public void DeletePerinatal_monitors(Perinatal_monitors perinatal_monitors)
        {
            if ((perinatal_monitors.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(perinatal_monitors, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Perinatal_monitors.Attach(perinatal_monitors);
                this.ObjectContext.Perinatal_monitors.DeleteObject(perinatal_monitors);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Prescriptions' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Prescription> GetPrescriptions()
        {
            return this.ObjectContext.Prescriptions;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Prescription> GetPrescriptionsForPatients(int patientId)
        {
            return this.ObjectContext.Prescriptions.Where(p => p.Patient_Id == patientId);
        }


        public void InsertPrescription(Prescription prescription)
        {
            if ((prescription.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(prescription, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Prescriptions.AddObject(prescription);
            }
        }

        public void UpdatePrescription(Prescription currentPrescription)
        {
            this.ObjectContext.Prescriptions.AttachAsModified(currentPrescription, this.ChangeSet.GetOriginal(currentPrescription));
        }

        public void DeletePrescription(Prescription prescription)
        {
            if ((prescription.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(prescription, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Prescriptions.Attach(prescription);
                this.ObjectContext.Prescriptions.DeleteObject(prescription);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Puerperium_monitors' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Puerperium_monitors> GetPuerperium_monitors()
        {
            return this.ObjectContext.Puerperium_monitors;
        }

        public void InsertPuerperium_monitors(Puerperium_monitors puerperium_monitors)
        {
            if ((puerperium_monitors.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(puerperium_monitors, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Puerperium_monitors.AddObject(puerperium_monitors);
            }
        }

        public void UpdatePuerperium_monitors(Puerperium_monitors currentPuerperium_monitors)
        {
            this.ObjectContext.Puerperium_monitors.AttachAsModified(currentPuerperium_monitors, this.ChangeSet.GetOriginal(currentPuerperium_monitors));
        }

        public void DeletePuerperium_monitors(Puerperium_monitors puerperium_monitors)
        {
            if ((puerperium_monitors.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(puerperium_monitors, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Puerperium_monitors.Attach(puerperium_monitors);
                this.ObjectContext.Puerperium_monitors.DeleteObject(puerperium_monitors);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Surgeries' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Surgery> GetSurgeries()
        {
            return this.ObjectContext.Surgeries;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Surgery> GetSurgeriesForPatients(int patientId)
        {
            return this.ObjectContext.Surgeries.Where(p => p.Patient_Id == patientId);
        }

        public void InsertSurgery(Surgery surgery)
        {
            if ((surgery.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(surgery, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Surgeries.AddObject(surgery);
            }
        }

        public void UpdateSurgery(Surgery currentSurgery)
        {
            this.ObjectContext.Surgeries.AttachAsModified(currentSurgery, this.ChangeSet.GetOriginal(currentSurgery));
        }

        public void DeleteSurgery(Surgery surgery)
        {
            if ((surgery.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(surgery, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Surgeries.Attach(surgery);
                this.ObjectContext.Surgeries.DeleteObject(surgery);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'SystemReviews' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<SystemReview> GetSystemReviews()
        {
            return this.ObjectContext.SystemReviews;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<SystemReview> GetSystemReviewsForPatients(int patientId)
        {
            return this.ObjectContext.SystemReviews.Where(p => p.Patient_Id == patientId);
        }

        public void InsertSystemReview(SystemReview systemReview)
        {
            if ((systemReview.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(systemReview, EntityState.Added);
            }
            else
            {
                this.ObjectContext.SystemReviews.AddObject(systemReview);
            }
        }

        public void UpdateSystemReview(SystemReview currentSystemReview)
        {
            this.ObjectContext.SystemReviews.AttachAsModified(currentSystemReview, this.ChangeSet.GetOriginal(currentSystemReview));
        }

        public void DeleteSystemReview(SystemReview systemReview)
        {
            if ((systemReview.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(systemReview, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.SystemReviews.Attach(systemReview);
                this.ObjectContext.SystemReviews.DeleteObject(systemReview);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Vaccinations' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Vaccination> GetVaccinations()
        {
            return this.ObjectContext.Vaccinations;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<Vaccination> GetVaccinationsForPatients(int patientId)
        {
            return this.ObjectContext.Vaccinations.Where(p => p.Patient_Id == patientId);
        }

        public void InsertVaccination(Vaccination vaccination)
        {
            if ((vaccination.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(vaccination, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Vaccinations.AddObject(vaccination);
            }
        }

        public void UpdateVaccination(Vaccination currentVaccination)
        {
            this.ObjectContext.Vaccinations.AttachAsModified(currentVaccination, this.ChangeSet.GetOriginal(currentVaccination));
        }

        public void DeleteVaccination(Vaccination vaccination)
        {
            if ((vaccination.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(vaccination, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Vaccinations.Attach(vaccination);
                this.ObjectContext.Vaccinations.DeleteObject(vaccination);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'WorkFlows' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<WorkFlow> GetWorkFlows()
        {
            return this.ObjectContext.WorkFlows;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<WorkFlow> GetWorkFlowsForPatients(int patientId)
        {
            return this.ObjectContext.WorkFlows.Where(p => p.Patient_Id == patientId);
        }

        public void InsertWorkFlow(WorkFlow workFlow)
        {
            if ((workFlow.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(workFlow, EntityState.Added);
            }
            else
            {
                this.ObjectContext.WorkFlows.AddObject(workFlow);
            }
        }

        public void UpdateWorkFlow(WorkFlow currentWorkFlow)
        {
            this.ObjectContext.WorkFlows.AttachAsModified(currentWorkFlow, this.ChangeSet.GetOriginal(currentWorkFlow));
        }

        public void DeleteWorkFlow(WorkFlow workFlow)
        {
            if ((workFlow.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(workFlow, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.WorkFlows.Attach(workFlow);
                this.ObjectContext.WorkFlows.DeleteObject(workFlow);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'WorkFlows' query.
        [Query(IsDefault = true, ResultLimit = 1000)]
        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<PediatricPSC> GetPediatricPsCs()
        {
            return this.ObjectContext.PediatricPSCs;
        }

        [OutputCache(OutputCacheLocation.None, duration: 10 * 60)]
        public IQueryable<PediatricPSC> GetPediatricPsCsForPatients(int patientId)
        {
            return this.ObjectContext.PediatricPSCs.Where(p => p.Patient_Id == patientId);
        }

        public void InsertPediatricPSC(PediatricPSC pediatricPSC)
        {
            if ((pediatricPSC.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(pediatricPSC, EntityState.Added);
            }
            else
            {
                this.ObjectContext.PediatricPSCs.AddObject(pediatricPSC);
            }
        }

        public void UpdatePediatricPSC(PediatricPSC currentPediatricPSC)
        {
            this.ObjectContext.PediatricPSCs.AttachAsModified(currentPediatricPSC, this.ChangeSet.GetOriginal(currentPediatricPSC));
        }

        public void DeletePediatricPSC(PediatricPSC pediatricPSC)
        {
            if ((pediatricPSC.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(pediatricPSC, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.PediatricPSCs.Attach(pediatricPSC);
                this.ObjectContext.PediatricPSCs.DeleteObject(pediatricPSC);
            }
        }

    }
}

